'''
Created on Jun 1, 2009

@author: mkiyer
'''

from optparse import OptionParser
from veggie.parser.wigparser import WIGFile
import sys

if __name__ == '__main__':
    # setup command line parser
    usage = "usage: %prog [options] infile outfile"
    
    # parse command line
    optparser = OptionParser()
    (options, args) = optparser.parse_args()
    # check options, args
    if len(args) < 1:
        optparser.error('No input file specified')

    # setup input and output files
    infhd = open(args[0])
    if len(args) < 2:
        outfhd = sys.stdout
    else:
        outfhd = open(args[1], 'w')

    # read wig file and process
    wig = WIGFile(infhd)
    wig.map(WIGFile.mapLog, outfhd)
    
    